package com.rd.student.jiaji.class3.wangyanbo.JulyTwelve;

import java.util.*;

public class FourFiveSeven {
    public static void main(String[] args) {
        System.out.println("---------------------");
        LinkedList list = new LinkedList();
        LinkedList list1 = new LinkedList();
        for (int a = 0; a < 10; a++) {
            int result = 1 + (int) (Math.random() * (99));
            list.add(result);
        }
        for (int j = 0; j < list.size(); j++) {
            if ((int) (list.get(j)) > 10) {
                list1.add(list.get(j));
            }
        }
        System.out.println(list);
        System.out.println(list1);
        System.out.println("------------------------");
        HashSet hashSet = new HashSet<>();
        String[] strs = {"12345", "67891", "123478099", "9876543", "67891", "12347809933", "12809933", "12347809933111", "9876543", "12809933"};
        for (int j = 0; j < strs.length; j++) {
            hashSet.add(strs[j]);

        }
        System.out.println(hashSet);
        System.out.println("________________________");
        String[] a = new String[]{"哈尔滨", "大庆", "绥化", "齐齐哈尔", "杭州", "宁波", "南昌", "广州", "福州", "厦门"};
        String[] a1 = new String[]{"黑龙江省", "黑龙江省", "黑龙江省", "黑龙江省", "浙江省", "浙江省", "江西省", "广东省", "福建省", "福建省"};

        HashMap hashMap = new HashMap();
        HashMap hashMap1 = new HashMap();
        String s;
        String s1 = "";
        for (int j = 0; j < a.length; j++) {
            hashMap.put(a[j], a1[j]);
        }
        info(hashMap);
        HashSet hashset = new HashSet();

        int num = 1;
        for (int j = 0; j < a1.length - 1; j++) {
            hashset.add(a1[j]);
            if (a1[j] == a1[j + 1]) {
                num++;
            } else {
                s = a1[j];
                s1 += s;
                hashMap1.put(a1[j], num);
                num = 1;
            }
        }
        s = a1[a1.length - 1];
        s1 += s;
        hashMap1.put(a1[a1.length - 1], num);
        System.out.println(s1);
        System.out.println(hashMap1);
        System.out.println(hashset);
        System.out.println();
        System.out.println("---------------------------------------");
    }

    public static void info (HashMap hashMap){
        Set set = hashMap.keySet();
        Iterator iterator = set.iterator();
        while (iterator.hasNext()) {
            Object key = iterator.next();
            Object value = hashMap.get(key);
            System.out.println("<" + key + "=" + value + ">");

        }
    }
}
